var authorize = {
  getAuthorizeUrl(
    option,
  ) {
    const {appid, redirect_uri, scope, state} = option
    if (!appid) {
      throw Error('appid 不能为空');
    }
    if (!redirect_uri) {
      throw Error('redirect_uri 不能为空');
    }
    let encodedRedirectUrl = encodeURI(redirect_uri);
    return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodedRedirectUrl}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`;
  }
}
window.wx.authorize = authorize
